<!doctype html>
<html lang="en">
<head>
    {% load static %}
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap.min.css' %}">
    <script src="{% static 'js/jquery-3.3.1.min.js' %}"></script>
    <script src="{% static 'js/bootstrap.min.js' %}"></script>
</head>
<body>

  <div class="container" style="margin-top: 10px">
      <div class="alert alert-danger text-center">
        <strong>未登录!</strong> 请登录后再操作！
      </div>
      <p class="text-center"><span id="sp">3</span>秒后自动跳转主页面</p>
  </div>
<script>
    onload=function () {
        setInterval(go,1000)
    };
    var x=2;
    function go() {

        if (x>=0){
            document.getElementById("sp").innerText=x;
        }else {
            location.href="{% url 'home:index' %}";
        }
        x--;
    }
</script>
</body>
</html>